package org.utnrepasa.net.util;

import java.io.Serializable;
import java.util.ArrayList;

/**
 * Representa una pregunta con sus opciones y la opción correcta.
 *
 * @author Parisi Germán
 * @version 1.0
 */
public class Question implements Serializable{

	private static final long serialVersionUID = 1005;
    /**
     * Es el id de la pregunta.
     */
    private int id;
    /**
     * Es la pregunta en sí, o sea, el texto.
     */
    private String description;
    /**
     * Son las opciones. Una de ellas es correcta.
     */
    private ArrayList<String> options;
    /**
     * Es la opción correcta.
     */
    private int correctOption;

    public Question(int id, String description) {
        this.id = id;
        this.description = description;
        this.options = new ArrayList<String>();
    }

    public Question(int id, String description, ArrayList<String> options, int correctOption) {
        this.id = id;
        this.description = description;
        this.options = new ArrayList<String>();
        this.correctOption = correctOption;
    }

    public int getId() {
        return id;
    }

    public String getDescription() {
        return description;
    }

    public ArrayList<String> getOptions() {
        return options;
    }

    public int getCorrectOption() {
        return correctOption;
    }

    public void setOptions(ArrayList<String> options) {
        this.options = options;
    }

    public void setCorrectOption(int correctOption) {
        this.correctOption = correctOption;
    }
    
    public void addOption(String option){
        this.options.add(option);
    }
    
    @Override
    public boolean equals(Object other){
        return this.id == ((Question)other).id;
    }
    
    @Override
    public String toString(){
        return description;
    }
}
